The vile, dopey, evil and odious game players

نویسنده

  • Aviezri S. Fraenkel
چکیده

Many of my friends celebrate anniversaries these days, be it 50th birthday, or 60th, 70th, 80th, even 90th. It is to be deplored that they all accumulate together, rather than distribute themselves uniformly over my lifetime! It is now Gert Sabidussi’s turn, who just joined the octogenarians club, and it is a pleasure to dedicate a paper to him, since he did, and continues to do, excellent algebraic graph theory, including insights into the automorphism group of graphs, studies of stable graphs, Sabidussi representation theorems for symmetric graphs, Sabidussi’s compatibility conjecture, Sabidussi graphs, etc. Many leadingmathematicians throughout theworld areworking on problems and insights initiated by Gert. He does all this in a relaxed playful way, as I witnessed when I acquired my own Sabidussi number 1. Hence it is only natural to relate here the fun that Gert and his friendWil had while playing games in Dubrovnik, where a grand conference took place in 2009 honoring Gert. Unfortunately, I had to skip that conference, but, unknown to them, I planted a listening device. © 2011 Elsevier B.V. All rights reserved. Wil: We have worked and published jointly on the complexity of graph focality. Now that one of us is already an octogenarian and the other is only a decade away, let us have some fun; let us play a game. Gert: I’m game. Wil: In the Fall 2009 issue of theMSRI gazette Emissary, Elwyn Berlekamp and Joe Buhler proposed the following puzzle: ‘‘Nathan and Peter are playing a game. Nathan always goes first. The players take turns changing a positive integer to a smaller one and then passing the smaller number back to their opponent. On each move, a player may either subtract one from the integer or halve it, rounding down if necessary. Thus, from 28 the legal moves are to 27 or to 14; from 27, the legal moves are to 26 or to 13. The game ends when the integer reaches 0. The player who makes the last move wins. For example, if the starting integer is 15, a legal sequence of moves might be to 7, then 6, then 3, then 2, then 1, and then to 0. (In this sample game one of the players could have played better!) Assuming both Nathan and Peter play according to the best possible strategy, who will win if the starting integer is 1000? 2000?’’ Let us dub it theMark game, since it is due to Mark Krusemeyer according to Berlekamp and Buhler. Gert: To get a feel for the Mark game, I’d construct a small table listing its P-positions (Previous player wins) and N-positions (Next player wins). For example, 0 ∈ P , since the Next (first) player cannot move, so the Previous (second) player wins by default, 1 ∈ N since Next can move to 0 ∈ P ; and 2 ∈ P . In general, every position that has a follower in P is in N , and every position all of whose followers are in N is in P (P and N are the set of all Pand N-positions respectively). E-mail address: [email protected]. URL: http://www.wisdom.weizmann.ac.il/∼fraenkel. 0012-365X/$ – see front matter© 2011 Elsevier B.V. All rights reserved. doi:10.1016/j.disc.2011.03.032 Author's personal copy A.S. Fraenkel / Discrete Mathematics 312 (2012) 42–46 43 Wil: (Extracting his palm computer). . .Here it is! n 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 P/N P N P N N N P N P N P N N N P N N N P N N N P N Gert: It is hard to see what’s going on. . . It might be useful to separate out the P-positions and the N-positions into two sequences. Wil: Alright, the rearranged table below suggests that bn = 2an for every nonnegative integer n, P = ∪n≥0 bn, N = ∪n≥1 an, where Nn = an, n ≥ 1; Pn = bn, n ≥ 0. But what’s Nn?. . .Oh I see, Nn = mex{Pi,Ni : 0 ≤ i < n} for every n ≥ 0, where the mex of a finite subset of nonnegative integers is the least nonnegative integer not in the set. In particular, the mex of the empty set is 0. Notice that the sequences (for n ≥ 1) are complementary: they split the positive integers n 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 an 0 1 3 4 5 7 9 11 12 13 15 16 17 19 20 21 23 25 27 28 29 31 33 35 bn 0 2 6 8 10 14 18 22 24 26 30 32 34 38 40 42 46 50 54 56 58 62 66 70 n 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 an 36 37 39 41 43 44 45 47 48 49 51 52 53 55 57 59 60 61 63 64 65 67 68 69 bn 72 74 78 82 86 88 90 94 96 98 102 104 106 110 114 118 120 122 126 128 130 134 136 138 n 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 an 71 73 75 76 77 79 80 81 83 84 85 87 89 91 92 93 95 97 99 100 101 103 105 107 bn 142 146 150 152 154 158 160 162 166 168 170 174 178 182 184 186 190 194 198 200 202 206 210 214 Gert: Since 15 ∈ N which has the follower 14 ∈ P , we indeed see, as hinted by Berlekamp–Buhler, that Nathan could have played better by moving 15 → 14 rather than 15 → 7, thus securing his win! But for deciding 1000 and 2000, the above recursive computation of the Pand N-positions is not too convenient. Is there a ‘‘closed form’’ formula for them, I wonder? Wil: Well, the second sequence is not a ‘‘spectrum’’, i.e., there exist no real α, γ such that bn = ∪n≥0⌊nα + γ ⌋ (⌊x⌋ is the integer part of the real number x), since a necessary — though not sufficient — condition for that is that for all n ≥ 0, bn+1−bn ∈ {k, k+1} for some integer k, and here the differences are 2 and 4. Since the sequences are complementary, also the first sequence is not a spectrum. . .However, the fact that there are two followers and one of them is halving, suggests to consider some sort of binary numeration system. Gert: The simplest such system is the ordinary positional binary system. . . Indeed, it appears that N is the set of all vile numbers, and P is the set of all dopey numbers. Wil: What are vile and dopey numbers? Gert: The vile numbers are those whose binary representations end in an even number of 0s, and the dopey numbers are those that end in an odd number of 0s. Wil: . . .No doubt their names are inspired by the evil and odious numbers, those that have an even and an odd number of 1’s in their binary representation respectively. To indicate that we count 0s rather than 1s, and only at the tail end, the ‘‘ev’’ and ‘‘od’’ are reversed to ‘‘ve’’ and ‘‘do’’ in ‘‘vile’’ and ‘‘dopey’’. ‘‘Evil’’ and ‘‘odious’’ where coined by Elwyn Berlekamp, John Conway and Richard Guy while composing their famous bookWinning Ways. Gert: Precisely. Indeed, the sequence {an}n≥1 consists of all alternately evil and odious numbers: a2n−1 odious, a2n evil (n ≥ 1); the same holds for {bn}n≥1, which is just a shift of {an}n≥1. . . Talking about shifts, let RB(m) denote the representation Author's personal copy 44 A.S. Fraenkel / Discrete Mathematics 312 (2012) 42–46 of a number m in the numeration system to base B. Since bn = 2an, R2(bn) is just a left shift of R2(an) : LR2(an) = R2(bn) for every n ≥ 0. Thus a9 = 13, R2(a9) = 1101, b9 = 26, R2(26) = 11010 . . . Now the binary representations of 1000 is 1111101000, and therefore that of 2000 is its left shift 11111010000. Therefore Peter, whomoves second, can win 1000 and Nathan, who moves first, can win 2000. This solves the puzzle for every positive integer k with a linear-time algorithm in its input size O(log k). Incidentally we have shown that {an}n≥1 is all vile if and only if {bn}n≥1 is all dopey. Anything else? Wil: Yes, but before that my palm notices that the sequences {an}n≥1 and {bn}n≥1 are the sequences A003159 and A036554 respectively in the famous Neslopedia. Gert: Neslopedia?. . .Oh, you mean Neil Sloane’s Encyclopedia of Integer Sequences, indeed a wonderful tool for doing math, especially discrete math. Wil: Yes! As to your question ‘‘anything else?’’, it would be nice to play this game in a sum of games. Gert: You mean, given a finite collection of games, Nathan and Peter each select a game at each of their turns and make a legal move therein? The player making the last move in the last surviving game wins? Wil: Yes on both counts. . . I think that the P,N tool is not strong enough to decide sums of games. Gert: . . .Right. For example, the sum of twoMark games with value n = 1 ∈ N is clearly a P-position in their sum, yet the sum of twoMark games with values n = 1 ∈ N and 3 ∈ N is an N-position in their sum. Indeed, the first player can move to (1, 1) and win. However, the sum of P-positions is always a P-position in the sum. Wil: To analyze sums, it is helpful to compute the Sprague–Grundy function of the component-games, g-function for short, and then compute the Nim-sum (or XOR, or sum over GF(2)) of their g-values: Nim-sum 0 is equivalent to a P-position of a single game; nonzero Nim-sum—to an N-position of a single game. . .My palm computer produced the following table. n 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 g 0 1 0 2 1 2 0 1 0 2 0 1 2 1 0 2 1 2 0 1 2 1 0 2 Gert: Notice that there can be no g-value larger than 2, since each game position has only two followers. All the 0s of g (beyond 0) clearly comprise all the dopey numbers — the P-positions. But which are 1s and which are 2s?. . .Oh, the odious and evil numbers raise their revolting heads again! All the 1s of g comprise all the vile-odious numbers and all the 2s of g comprise all the vile–evil numbers. Wil: So if I leave you in the 3-game position (1, 3, 4) where will you move to? Gert: Well, 1+ 3+ 4 = 8, so I see that you left me in a P-position from which, whatever I do, I’ll lose. I expected a more gentlemanly gesture from you. Wil: You are indeed vile and evil! Gert: I think that we won’t be friends anymore after all these unwarranted insults! Wil: All I meant is that the position I suggested to you is vile–evil: g(1)⊕g(3)⊕g(4) = 1⊕2⊕1 = 2 (where⊕ denotes Nim-sum), and g(n) = 2, is equivalent to a single game where n is vile–evil, as you had pointed out previously. I suggested to you a position from which you can win, namely, with the move 3 → 2. Then g(1) ⊕ g(2) ⊕ g(4) = 1 ⊕ 0 ⊕ 1 = 0. Gert: Indeed, this move makes the position dopey. I apologize profusely. I erred twice: Instead of Nim-summing the gvalues, I summed their arguments. . . Sequence A091855 of the Neslopedia seems to confirm that {n : g(n) = 1} comprises all vile-odious numbers, and sequence A091785 seems to confirm that {n : g(n) = 2} comprises all vile–evil numbers, so A091855 ∪ A091785 = A003159 . . . Incidentally, until now we considered normal games, that is, the player making the last move wins. What about misère play ofMark, where the player making the last move loses? Wil: Then we can assume that 1 is the last move, so 1 ∈ P . This, with the help of my palm, produces the following results, where Nn = an and Pn = bn, n ≥ 0. n 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 an 0 2 3 5 7 8 9 11 12 13 15 17 19 20 21 23 25 27 28 29 31 32 33 35 bn 1 4 6 10 14 16 18 22 24 26 30 34 38 40 42 46 50 54 56 58 62 64 66 70 Gert: So formisère play ofMark, we seem to have an = mex{ai, bi : 0 ≤ i < n} for n ≥ 0, b0 = 1 and bn = 2an for n ≥ 1. The two sequences split the nonnegative integers, and LR2(an) = R2(bn). Is there again a ‘‘digital’’ characterization?. . .Yes, it appears that P ofMark’s misère play is the set of all dopey numbers except that all dopey powers of 2 are swapped with all vile powers of 2; and N is the set of all vile numbers except that all vile powers of 2 are swapped with all dopey powers of 2. This provides a linear algorithm in the input size O(log k) of k for deciding whether k ∈ P or k ∈ N for misère play of Mark. Author's personal copy A.S. Fraenkel / Discrete Mathematics 312 (2012) 42–46 45 Wil: These two sequence are not yet in the Neslopedia, but, as you point out, the {an}n≥1-sequence is the same as A003159 except for the interchange of vile by dopey powers of 2, and {bn}n≥1 is the same as A036554 except for the interchange of dopey by vile powers of 2. . .We could compute the g-function for this game, but it would only enable us to play sums ofMark’s game, where the end position of each component game is 1. For the sum ofMark’s misère plays, the end position of every component game is 0, except for the one played last, whose end position is 1. What do you think? Gert: I agree, and we better leave themisère sum analysis to the famousmisère gurus Thane Plambeck and Aaron Siegel, though the P-positions of normal andmisère play agree except that the powers of 2 are swapped. This value-swapping occurs sometimes in swapping between normal and misère play. For example, the renownedmathematician Vladimir Gurvich has recently observed and proved a similar behavior in swapping between normal andmisère play in a certain generalization of Wythoff’s game. . .Wemight nowwish to examine the game UpMark, which is the same asMark, except that when halving, we round up rather than down. For example, the only follower of 3 is 2. Wil: . . . In normal play, where the player making the last move to 0 wins, the position 1 has followers 0 and 1 in UpMark. The game is thus loopy, and it is the generalized Sprague–Grundy function γ that’s needed. In fact, γ (1) = ∞(0), and the sum of two UpMark games with position (1, 1) is clearly a draw. Gert: Alright, so for the time being, let us consider the version where 1 is the end-position: the player first reaching 1 wins. . .My PC produced the following table for UpMark, where Nn = an for n ≥ 1 and Pn = bn for n ≥ 0. n 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 an 0 2 4 5 6 8 10 12 13 14 16 17 18 20 21 22 24 26 28 29 30 32 34 36 bn 1 3 7 9 11 15 19 23 25 27 31 33 35 39 41 43 47 51 55 57 59 63 67 71 Wil: It appears that an = mex{ai, bi : 0 ≤ i < n} for n ≥ 0, b0 = 1 and bn = 2an − 1 for n ≥ 1, and the two sequences split the nonnegative integers. . . It further seems that the P-positions are all odd numbers that are alternately odious and evil, greedily chosen, beginning with 1, which is odious. Define the spite of k to be evil if k is evil; odious if k is odious. Then ‘‘greedily chosen’’ means the following: 1 ∈ P , and if we have already shown that 2k − 1 ∈ P , then 2k + 1 ∈ P if 2k − 1 and 2k + 1 are of opposite spite. Otherwise 2k + 3 ∈ P . Also odious and evil numbers alternate. . . Incidentally, neither the annor the bn-sequence is in the Neslopedia. Gert: The set of odd excluded numbers from {bn} is S0 = 5, 13, 17, 21, 29, 37, 45, 49, 53, 61, 65, 69, . . . , which is not in the Neslopedia either. But the set of bn-numbers just before the excluded ones, namely S− = 3, 11, 15, 19, 27, 35, 43, 47, 51, 59, 63, 67, . . . is A131323 in theNeslopedia—all odd numbers whose binary representation ends in an even number of 1’s. Evil and odious numbers alternate. On the other hand, the set of bn-numbers just after the excluded ones, namely S+ = 7, 15, 19, 23, 31, 39, 47, 51, 55, 63, 67, 71 . . . is not in the Neslopedia. They appear to be all odd numbers whose binary representations end in 11, such that odious and evil numbers alternate. Thus S0 = S− + 2 = A131323 + 2 = S+ − 2. Wil: Is there a concise characterization of P for UpMark, I wonder?. . .Yes! Given a positive odd integer k in binary expansion, we examine its spite. If k and k − 2 have opposite spite-parity, then k ∈ P . Otherwise, k − 2 ∈ P and k ∈ N . This constitutes a linear algorithm in the input size O(log k) of k for determining whether or not k ∈ P . Gert: Notice that S0 appears to consist of precisely all alternately evil and odious numbers whose binary representation ends in 1k02n+11, where n ≥ 0, k ≥ 1, i.e., a prefix of an odd number of 0s followed by 1. And {an}n≥0 consists of all even positive integers together with S0, so R2(an) either ends in 0 or in 02n+11 for every n ≥ 0. Since {an}n≥0 and {bn}n≥0 split the nonnegative integers, R2(bn) consists of precisely all numbers whose binary representation ends in 1k, k > 1, or in 02k1 for every k ≥ 0. Evil and odious numbers alternate in {bn}n≥0. This provides another linear algorithm. Wil: Nice. I’d like to break out of the binary numeration system. . . Let us consider the ternary system first. . .DefineMark3 by taking 1 or 2 from n or moving to ⌊n/3⌋. Again the game ends when the integer reaches 0, and the player making the last move wins. Will the ternary system provide a winning strategy? Gert: Well, here is what my PC produced. As usual we seem to have an = mex{ai, bi : 0 ≤ i < n}, where now bn = 3an, which looks promising. We have Pn = bn for n ≥ 0, and Nn = an for n ≥ 1, the sequences split the positive integers for n ≥ 1. . .Bravo, the sequence {an}n≥1 seems to consist of all vile numbers in the ternary numeration system, and therefore {bn}n≥1 seems to consist of all dopey numbers in the ternary numeration system. The latter part follows from LR3(an) = R3(bn). So for every k ≥ 2, defineMark-k as the game of removing one of 1, 2, . . . , k− 1 from n, or moving n to Author's personal copy 46 A.S. Fraenkel / Discrete Mathematics 312 (2012) 42–46 ⌊n/k⌋ (where Mark-2 = Mark). Then the conjecture is that the P-positions and N-positions of Mark-k are the dopey and vile numbers respectively in the numeration system to base k, and LRk(an) = Rk(bn). n 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 an 0 1 2 4 5 7 8 9 10 11 13 14 16 17 18 19 20 22 23 25 26 28 29 31 bn 0 3 6 12 15 21 24 27 30 33 39 42 48 51 54 57 60 66 69 75 78 84 87 93 Wil: I see that the sequence {bn}n≥1 ofMark-3 is A145204 in the Neslopedia, and {an}n≥1 is A007417. . . I have just verified our conjecture for k = 4, as can be seen from the next table. In fact, an = mex{ai, bi : 0 ≤ i < n}, bn = 4an for all n ≥ 0. These two sequences, which are not in the Neslopedia, split the positive integers (n ≥ 1), R4(bn) is dopey (n ≥ 1), R4(an) is vile (n ≥ 1) in the quaternary numeration system, and LR4(an) = R4(bn). Incidentally,Mark-k resembles subtraction games, which are take-away games with a finite set of positive integers that can be taken away from the game positions. The main result on subtraction games is that their g-function is periodic. Alas, this does not seem to be the case forMark-k for any k ≥ 2. . .Now we might change the move ⌊n/k⌋ to ⌈n/k⌉ as we did for k = 2, examine the g-function for Mark-k, look at misère play. . .But I’d like to consider the variation. . . n 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 an 0 1 2 3 5 6 7 9 10 11 13 14 15 16 17 18 19 21 22 23 25 26 27 29 bn 0 4 8 12 20 24 28 36 40 44 52 56 60 64 68 72 76 84 88 92 100 104 108 116 Gert: I admit that we really had fun, however, I’m getting rather famished. . . Wil: But what about proofs? Gert:Well, we did experimentalmath, a topic in which the eminent guru Doron Zeilberger excels.Wemight as well leave proofs to the younger generation. . . for example to Aviezri. I was born October 28, 1929, way before the end of 1929, so it stands to reason that he was born much later in 1929! Wil: So we’ll have to wait a zillion years until we see proofs! Gert: Don’t be a smarty. You know that I meant an exclamation mark, not a factorial—Let us now go to have dinner. Wil: All I meant is that it will take that guy a zillion years to write up the proofs. . . Let me provide a short sample proof before we go to dinner. Denote by C(n) ∈ P , N the character of a given n ∈ Z≥0, that is its membership n ∈ P or n ∈ N . Proposition 1. The gameMark is aperiodic. Proof. Suppose that there are constants r, n0 ∈ Z≥1 such that C(n) = C(n + r) for all n ≥ n0. For t ∈ Z≥1, we may assume that 2rt ∈ P , since if 2rt ∈ N , then 4rt ∈ P , so we replace t by 2t . For t large enough, we have, in addition, C(2rt) = C(2rt + 2(t + 1)r) = C(4rt + 2r) by the assumed periodicity. Now one of the followers of 4rt + 2r is half of this number, namely 2rt + r . Then C(2rt) = C(2rt + r) = C(4rt + 2r). Thus both 4rt + 2r and its follower 2rt + r are in P , a contradiction. Gert: Nice. Since the P-positions are aperiodic, so is the g-function, a fortiori. . . Thanks for the very nice time. Now we are indeed ready for dinner.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Rrr 1 - 2012 on the Repetition - Free Subtraction Games and Vile –

RRR 1-2012 ON THE REPETITION-FREE SUBTRACTION GAMES AND VILE–DOPEY INTEGERS, Vladimir Gurvich Given two integers n ≥ 0 and k ≥ 3, two players alternate turns taking stones from a pile of n stones. By one move a player is allowed to take any number of stones k′ ∈ {1, . . . , k − 1}. In particular, it is forbidden to pass. Furthermore, it is not allowed to take the same number of stones as the op...

متن کامل

Evil twins alternate with odious twins

An integer is called evil if the number of ones in its binary expansion is even and odious if the number of ones in the binary expansion is odd. If we look at the integers between 0 and 15 we find that 0, 3, 5, 6, 9, 10, 12, 15 are evil and that 1, 2, 4, 7, 8, 11, 13, 14 are odious. Next we say that if two consecutive integers are evil then this is a pair of evil twins and that if two consecuti...

متن کامل

A Conjecture on Primes and a Step towards Justification*

For example, all the Fermat primes are evil while all the Mersenne primes > 3 are odious. Using direct calculations up to 10 we noticed that among the primes not exceeding n the evil primes are never in majority except for the cases n = 5 and n = 6. Moreover, in the considered limits the excess of the odious primes is not monotone but increases on the whole with records on primes 2, 13, 41, 67,...

متن کامل

The Beneficial or Harmful Effects of Computer Game Stress on Cognitive Functions of Players

Introduction: Video games are common cultural issues with great influence in all societies. One of the important cognitive effects of video games is on creating stress on video players. The present research objective was to study different types of stress in players based on video game styles.&nbsp; Methods: A total of 80 players, aged 18 to 30 years, played four types of video games;&nbsp; Ru...

متن کامل

The Beneficial or Harmful Effects of Computer Game Stress on Cognitive Functions of Players

Introduction: Video games are common cultural issues with great influence in all societies. One of the important cognitive effects of video games is on creating stress on video players. The present research objective was to study different types of stress in players based on video game styles.&nbsp; Methods: A total of 80 players, aged 18 to 30 years, played four types of video games;&nbsp; Ru...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • Discrete Mathematics

دوره 312  شماره 

صفحات  -

تاریخ انتشار 2012